
<!DOCTYPE html>

<html>
  <head>
    <title>Edit</title>
    <script type="text/javascript" src="/static/tiny_mce/tiny_mce.js"></script>

    <script type="text/javascript">
      tinyMCE.init({
            mode : "textareas"
      });
    </script>
  </head>

  <style>
    body {
      position: relative;
      font-family: sans-serif;
      width: 800px;
      margin: 0 auto;
      padding: 10px;
    }

    .error {
      color: red
    }

    label {
      display: block;
      font-size: 20px;
    }

    input[type=text] {
      width: 100%;
      font-size: 20px;
      padding: 2px;
    }

    textarea.title {
      width: 100%;
      height: 40px;
      font-size: 17px;
      font-family: monospace;
    }

    textarea.content {
      width: 100%;
      height: 500px;
      font-size: 17px;
      font-family: monospace;
    }

    input[type=submit] {
      font-size: 24px;
    }

    hr {
      margin: 20px auto;
    }

    .fixed {
      position: absolute;
      top: 20px;
      right: 20px;
      color: gray;
      font-size: 12px;
    }

  </style>

  <body>
    {% if not newpage %}
  	<div class="fixed">
      {% if u %}<a href="/_edit/{{page.url}}?v={{page.key().id()}}">Edit | </a>{% endif %}
      {% if u %}<a href="/_history{{page.url}}">History</a>{% endif %}
      {% if not u %}
        <a href="/login">Login</a>
      <a href="/signup">Signup</a>
      {% endif %}
      <a href="/logout">Logout</a>
  	</div>
    <form method="post" action="/_edit{{page.url}}?v={{page.key().id()}}">
      <label>
        <div>Page Title</div>
        <textarea class="title" name="title">{{page.title}}</textarea>
      </label>
      <label>
        <div>Page Content</div>
        <textarea class="content" name="content">{{page.content}}</textarea>
      </label>
      <input type="submit">
    </form>
    {% endif %}
    {% if newpage %}
    <form method="post" action="/_edit{{page.url}}">
      <label>
        <div>Page Title</div>
        <textarea class="title" name="title"></textarea>
      </label>
      <label>
        <div>Page Content</div>
        <textarea class="content" name="content"></textarea>
      </label>
      <input type="submit">
    </form>
    {% endif %}

  </body>
</html>